package com.sanyang.logistics.liuxu.handler;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sanyang.logistics.liuxu.dao.Dwdao;
import com.sanyang.logistics.liuxu.service.DwService;
import com.sanyang.logistics.pojo.StandardUnit;

@Controller
@RequestMapping("/dw")

public class DwHAndler {
    @Autowired

	private Dwdao dao;
    
  //标准单位查询全部
    @RequestMapping("/dwdas")
    @ResponseBody
    public Object dadas(StandardUnit unit) {
    	System.out.println(unit);
		List<StandardUnit> dwqueryAll = dao.dwqueryAll(unit);
		System.out.println(dwqueryAll);
	return dwqueryAll;
    }
    
    
  //标准单位模糊查询
//    @RequestMapping("/dwdass")
//    @ResponseBody
//    public Object dadas(StandardUnit sUnit) {
//	 List<StandardUnit> dwqueryOne = dao.dwqueryOne(sUnit);
//	return dwqueryOne;
//    }
    
  //标准单位删除
    @RequestMapping("/dwdel")
    @ResponseBody
    public Object dwdel(Integer unitid) {
		dao.dwdel(unitid);
		StandardUnit unit = new StandardUnit();
		return dao.dwqueryAll(unit);
	}
    
    
  //标准单位添加
    @RequestMapping("/dwinsert")
    @ResponseBody
   public Object dwinsert(StandardUnit sUnit) {
	dao.dwinsert(sUnit);
	return dao.dwqueryAll(sUnit);
}
    
    //修改拿值
    @RequestMapping("/dwxuigai")
    @ResponseBody
    public Object dwxuigai(Integer unitid) {
    	System.out.println(unitid);
		return dao.dwxuigai(unitid);
	}
    
    //修改
    @RequestMapping("/dwupdate")
    @ResponseBody
    public Object dwupdate(StandardUnit sUnit) {
    	System.out.println(sUnit);
		dao.dwupdate(sUnit);
		return dao.dwqueryAll(sUnit);
	}
    
    
  //添加填充下拉框
    @RequestMapping("/queryStandard_unit")
    @ResponseBody
    public Object queryStandard_unit() {
    	 
    	return  dao.queryStandard_unit();
	}
    
}
